package com.jizhi.controller;


import com.alibaba.fastjson.JSONArray;
import com.jizhi.entity.Supplier;
import com.jizhi.service.SupplierService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 王书豪
 * @since 2020-11-18
 */
@RestController
@RequestMapping("/supplier")
public class SupplierController {
    @Resource
    private SupplierService supplierService;
    @GetMapping("/SelectAll")
    @ApiOperation(value = "查询全部供应商信息", notes = "查询所有供应商信息")
    @ResponseBody
    public Object SelectAll(){
        List<Supplier> list= supplierService.seltAll();
        if (null!=list){
            String json= JSONArray.toJSONString(list);
            return list;
        }else {
            return "查询失败";
        }
    }
}

